<?php
include '../../../common.inc.php';
include 'fun.php';
$mysqli = new mysqli('localhost', 'root', '', 'test_data');
# 重复的加上地区后缀
# 更新服务商类型
# 小于四个字符的
# 空字符的
# 转换为小写
$start = isset($start) ? (int) $start : 0;
$sql = "select py_lower, id from koubei_myisam2 where id>{$start} order by id ASC limit 100";

$result = $mysqli->query($sql);
$res = $result->fetch_all(MYSQLI_ASSOC);
if (!$res) exit('No More Results');

foreach ($res as $r) {
	$lower = strtolower($r['py_lower']) ;
	if ($lower !== $r['py_lower']) {
		$sql = "update koubei_myisam2 set py_lower ='{$lower}' WHERE ID = {$r['id']}";
		$mysqli->query($sql);
	} else {
		continue;
	}

}
$start = (int) ($r['id']);
echo '<meta http-equiv="refresh" content="0; url='.$_SERVER['PHP_SELF'].'?start='.$start.'" />';
echo '<pre style="font-size:100px;">';
echo $r['id'] .'-'. $r['py_lower'];

?>